<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>CodeAgar API documentation</title>
    <style>
        code {
            background-color: #f8f8f8;
            border: 1px solid #ddd;
            border-radius: 2px;
            margin: 0 2px;
            padding: 0 4px;
        }
    </style>
</head>
<body>
    <h1>A really bad documentation for CodeAgar</h1>
    <h3>game.gameHeight</h3>
    <p>
        The height of the game. Altering its value makes no sense.
    </p>
    <h3>game.gameWidth</h3>
    <p>
        The width of the game. Altering its value makes no sense.
    </p>
    <h3>game.posError</h3>
    <p>
        A variable used to deal with the weird calculation of player position. May cause odd behavior. Change with care.
    </p>
    <h3>game.foods()</h3>
    <p>
        Returns a list of visible food particles.<br/>
        A food particle is represented as an <code>Object</code> consisting of these fields:
        <code>x</code>,
        <code>y</code>,
        <code>radius</code>,
        <code>mass</code>.
    </p>
    <h3>game.viruses()</h3>
    <p>
        Returns a list of visible viruses.<br/>
        A virus is represented as an <code>Object</code> consisting of these fields:
        <code>x</code>,
        <code>y</code>,
        <code>radius</code>,
        <code>mass</code>.
    </p>
    <h3>game.ejectedMasses()</h3>
    <p>
        Returns a list of visible masses ejected by other cells.<br/>
        An ejected mass is represented as an <code>Object</code> consisting of these fields:
        <code>owner</code>,
        <code>x</code>,
        <code>y</code>,
        <code>radius</code>,
        <code>mass</code>.<br/>
        <code>owner</code> is the unique websocket id of the mass's owner.
    </p>
    <h3>game.otherCells()</h3>
    <p>
        Returns a list of visible enemy cells.<br/>
        A cell is represented as an <code>Object</code> consisting of these fields:
        <code>owner</code>,
        <code>x</code>,
        <code>y</code>,
        <code>radius</code>,
        <code>mass</code>.<br/>
        <code>owner</code> is the unique websocket id of the cell's owner.
    </p>
    <h3>game.ownCells()</h3>
    <p>
        Returns a list of your own cells.<br/>
        A cell is represented as an <code>Object</code> consisting of these fields:
        <code>x</code>,
        <code>y</code>,
        <code>radius</code>,
        <code>mass</code>.
    </p>
    <h3>game.leaderboard()</h3>
    <p>
        Returns a list of top players on this server.<br/>
        A player is represented as an <code>Object</code> consisting of these fields:
        <code>id</code>,
        <code>name</code>.<br/>
        <code>id</code> is the unique websocket id of the player.<br/>
        <code>name</code> is the player's username.
    </p>
    <h3>game.getPos()</h3>
    <p>
        Returns an <code>Object</code> containing your position.<br/>
        Use <code>x</code> and <code>y</code> property of the returned object to retrieve your position.
    </p>
    <h3>game.setTarget(x, y)</h3>
    <p>
        No return values.<br/>
        All arguments are <code>Number</code>.<br/>
        Sets your target to (<code>x</code>, <code>y</code>).
    </p>
    <h3>game.fireMass()</h3>
    <p>
        No return values.<br/>
        Just like pressing W in the original Agar.io.
    </p>
    <h3>game.split()</h3>
    <p>
        No return values.<br/>
        Just like pressing SPACE in the original Agar.io.
    </p>
    <h3>game.setRunAtUpdate(fun)</h3>
    <p>
        No return values.<br/>
        <code>fun</code> can be <code>Function</code> or <code>String</code>.<br/>
        Sets the function to run every time when game server sends back game updates to <code>fun</code>.
    </p>
    <h3>game.allReachedTarget()</h3>
    <p>
        Returns a boolean value indicating whether you have reached the target you last set.<br/>
        Does <b>not</b> mean <b>all</b> cells have touched the target!
    </p>
    <h3>game.oneCellReachedTarget()</h3>
    <p>
        Returns a boolean value indicating whether at least one of your cells has touched the target you last set.
    </p>
    <h3>game.pointInCircle(circle_x, circle_y, point_x, point_y, circle_radius)</h3>
    <p>
        Returns a boolean value indicating whether the given point is <b>inside</b> the given circle.<br/>
        All arguments are <code>Number</code>.<br/>
        Feel free to override this function if you have a better one, but do <b>not</b> change its function signature!
    </p>
    <h3>game.log(string)</h3>
    <p>
        No return values.<br/>
        <code>string</code> is <code>String</code>.<br/>
        Prints a line in your chat window. <code>string</code> can contain HTML tags.<br/>
        Will <b>not</b> send a real chat message to game server.
    </p>
</body>
</html>
